﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ShoppingApp
{
    public partial class TestCookie : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirect = Request.QueryString["redirect"];
            string decision = null;

            if (Request.Cookies["TestCookie"] == null)
            {
                decision = "no";
            }
            else
            {
                //Delete existing cookie
                Response.Cookies["TestCookie"].Expires = DateTime.Now.AddDays(-1);
                decision = "yes";
            }

            Response.Redirect(redirect + "?AcceptCookies=" + decision, true);
        }
    }
}